package com.bit.IO;

import java.io.*;

public class IOTest3 {
    public static void main(String[] args) {
        copyFile1("d:/test/1234.jpg","d:/test/3.jpg");
    }
    private static void copyFile1(String srcPath,String desPath){
        try(BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream(srcPath));
        BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new FileOutputStream(desPath))){
            byte[] buffer = new byte[1024];
            int len = -1;
            while((len = bufferedInputStream.read(buffer)) != -1){
                System.out.println("len:"+len);
                bufferedOutputStream.write(buffer,0,len);
            }
        }catch (IOException e){
            e.printStackTrace();
        }
    }
}
